<?php

// $Author: tropic $
// $Date: 2005/11/21 13:51:03 $
/************************************************************************/
/* xml-extractor for Php-MultiShop                                      */
/* Copyright (c) 2003-2005 by Piero Trono                               */
/* http://www.php-multishop.com                                         */
/* ============================                                         */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/


$nukelogo = htmlspecialchars($nukeurl) . "/images/ms-logo.gif";
$creator ="Your name for Creator of RSS";

@require_once("mainfile.php");
global $Conf_Multishop, $prefix, $db, $nukeurl;

$limit_specials = 10;
$limit_reviews = 5;
$limit_best = 5;
$language_id = $lang_id[$currentlang];
if (!isset($language_id)){
	$language_id = 1;
}
$currencies = new currencies();
$decimal_places = $currencies->get_decimal_places($currentcurrency);
if (isset($vendors_id) && $vendors_id != ""){
	$vendors_id = intval($vendors_id);
	$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where vendors_id=$vendors_id");
} else {
	$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors  ORDER BY RAND() LIMIT 0,1");
}

function product_random(){
	global $Conf_Multishop, $creator, $nukelogo, $nukeurl, $prefix, $shop_id, $backend_language, $sitename, $show_tax, $currentcurrency, $language_id, $decimal_places, $db; 
	$included_tax = $Conf_Multishop['include_taxrate'];
	$show_tax = $Conf_Multishop['show_taxrate'];
	$today = date("j F Y, G:i:s T"); 
	if (isset($shop_id) && intval($shop_id)){
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_prods='1' and vendors_id=$shop_id");
		if (!$db->sql_numrows($result)){
			$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_prods='1' ORDER BY RAND() LIMIT 0,1");
		}
	} else {
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_prods='1' ORDER BY RAND() LIMIT 0,1");
	}
	
	$row = $db->sql_fetchrow($result);
	$vend_id = $row['vendors_id'];
	$vend_prefix = $row['vendors_prefix'];
	$host = $row['vendors_host'];
	$name = $row['vendors_name'];
	$pos = strrpos($host, '/');
	$host = substr($host, 0, $pos);
	
	header("Content-Type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
		."<!-- RSS generated by Php-MultiShop for $sitename on $today -->\n"
		."<rss version=\"2.0\" xmlns:multishop=\"http://php-multishop.com/multishop.xml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"
		."<channel>\n"
		."<title>".htmlspecialchars($name)."</title>\n"
		//."<guid>".$vend_id."</guid>\n"
		."<link>http://$host</link>\n"
		."<generator>RSS generated by Php-MultiShop</generator>"
		."<category>".htmlspecialchars($row['vendors_type'])."</category>\n";

	$products_new_query_raw = "select p.products_id, p.products_image, p.products_price, pd.products_name, pd.products_description from " . $vend_prefix . "_" . TABLE_PRODUCTS . " p, " . $vend_prefix . "_" . TABLE_PRODUCTS_DESCRIPTION . " pd where products_status = '1' and p.products_id = pd.products_id and (pd.language_id = '" . $language_id . "' or pd.language_id = '1') ORDER BY RAND() LIMIT 0,1";
	$Res = $db->sql_query($products_new_query_raw);
	if (!$db->sql_numrows($Res)){
		echo "<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a><br/>"
			."&nbsp;Products not found on ".htmlspecialchars($name)."]]></description>\n"
			."</channel>\n"
			."</rss>";
	} else {

		$Row = $db->sql_fetchrow($Res);
		$prod_id = $Row['products_id'];

		$category_query = "select c.categories_id, cd.categories_name from " . $vend_prefix . "_" . TABLE_PRODUCTS . " p, " . $vend_prefix . "_" . TABLE_CATEGORIES . " c, " . $vend_prefix . "_" . TABLE_CATEGORIES_DESCRIPTION . " cd, " . $vend_prefix . "_" . TABLE_PRODUCTS_TO_CATEGORIES . " pc where pc.products_id = '" . $prod_id ."' and pc.categories_id = c.categories_id and c.categories_id = cd.categories_id and (cd.language_id = '" . $language_id . "' or cd.language_id = '1') LIMIT 1";
		$category_result = $db->sql_query($category_query);
		$category_row = $db->sql_fetchrow($category_result);
		$category_id = $category_row['categories_id'];
		$category_name = $category_row['categories_name'];
		
		$prod_image = $Row['products_image'];
		$price = $Row['products_price'];
		$prod_name = $Row['products_name'];
		$prod_descr = $Row['products_description'];
	
		$prod_url = "http://" . $host ."/". "product_info.php?products_id=" . $prod_id;
		$prod_image = "http://" . $host ."/". "images/" . $prod_image;
				
		$tax_result = $db->sql_fetchrow($db->sql_query("select * from " . $vend_prefix . "_tax_rates"));
		$tax = $tax_result['tax_rate'];
		$prod_tax = tep_round($tax, $decimal_places);
		if ($included_tax == 1){
			$new_price = $price * ($tax / 100 +1);
			$new_price = tep_round($new_price, $decimal_places);
			$prod_price = tep_round($new_price, $decimal_places);
		} else {
			$prod_price = tep_round($price, $decimal_places);
		}		
		
		echo "<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a><br/>"
			."&nbsp;A Product Random from ".htmlspecialchars($name)."]]></description>\n"
			."<language>$backend_language</language>\n\n"
			."<item>\n"
			. "<title>".htmlspecialchars($prod_name)."</title>\n"
			. "<link>$prod_url</link>\n";
			//. "<guid>".$vend_id."_".$prod_id."</guid>\n";
			
?>
<description><![CDATA[A Product Random from <? echo htmlspecialchars($name); ?>
<br/>
<a href="<? echo $prod_url; ?>"><img alt="<? echo $prod_name; ?>" src="<? echo $prod_image; ?>" align="right" border="0"/></a>
<p>
<?
echo "<b>$prod_name</b><br/><br/>"
	. $prod_price . " " . $currentcurrency ."<br/><br/>"
	. $prod_descr;
?>
</p>]]></description>
<?
		echo "<category>$category_name</category>\n"
			."<dc:creator>$creator</dc:creator>"
			. "<multishop:prod_image>$prod_image</multishop:prod_image>\n"
			. "<multishop:prod_price>$prod_price</multishop:prod_price>\n"
			. "<multishop:prod_currency>$currentcurrency</multishop:prod_currency>\n";
			if ($show_tax == 1 && $prod_tax) echo "<multishop:tax>$prod_tax</multishop:tax>\n";
		echo  "</item>\n"
			."</channel>\n"
			."</rss>";
	}
}

function specials(){
	global $Conf_Multishop, $creator, $nukelogo, $nukeurl, $prefix, $shop_id, $backend_language, $sitename, $limit_specials, $currentcurrency, $language_id, $decimal_places, $db; 
	$included_tax = $Conf_Multishop['include_taxrate'];
	$show_tax = $Conf_Multishop['show_taxrate'];
	$today = date("j F Y, G:i:s T"); 
	if (isset($shop_id) && intval($shop_id)){
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_specials='1' and vendors_id=$shop_id");
		if (!$db->sql_numrows($result)){
			$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_specials='1' ORDER BY RAND() LIMIT 0,1");
		}
	} else {
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_specials='1' ORDER BY RAND() LIMIT 0,1");
	}
	
	$row = $db->sql_fetchrow($result);
	$vend_id = $row['vendors_id'];
	$vend_prefix = $row['vendors_prefix'];
	$host = $row['vendors_host'];
	$name = $row['vendors_name'];
	$pos = strrpos($host, '/');
	$host = substr($host, 0, $pos);

	header("Content-Type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
		."<!-- RSS generated by Php-MultiShop for $sitename on $today -->\n"
		."<rss version=\"2.0\" xmlns:multishop=\"http://php-multishop.com/multishop.xml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"
		."<channel>\n"
		."<title>".htmlspecialchars($name)."</title>\n"
		//."<guid>".$vend_id."</guid>\n"
		."<link>http://".$host."</link>\n"
		."<category>".htmlspecialchars($row['vendors_type'])."</category>\n";

	$string_query = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, pd.products_description, s.specials_new_products_price from " . $vend_prefix . "_" . TABLE_PRODUCTS . " p, " . $vend_prefix . "_" . TABLE_PRODUCTS_DESCRIPTION . " pd, " . $vend_prefix . "_" . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added desc limit $limit_specials"; // . MAX_RANDOM_SELECT_SPECIALS)) {
	$Res = $db->sql_query($string_query);
	if (!$db->sql_numrows($Res)){
		echo "<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a><br/>"
			."&nbsp;Special Offers not found on ".htmlspecialchars($name)."]]></description>\n"
			."</channel>\n"
			."</rss>";
	} else {
	
		$Row = $db->sql_fetchrow($Res);
		$prod_id = $Row['products_id'];

		$category_query = "select c.categories_id, cd.categories_name from " . $vend_prefix . "_" . TABLE_PRODUCTS . " p, " . $vend_prefix . "_" . TABLE_CATEGORIES . " c, " . $vend_prefix . "_" . TABLE_CATEGORIES_DESCRIPTION . " cd, " . $vend_prefix . "_" . TABLE_PRODUCTS_TO_CATEGORIES . " pc where pc.products_id = '" . $prod_id ."' and pc.categories_id = c.categories_id and c.categories_id = cd.categories_id and (cd.language_id = '" . $language_id . "' or cd.language_id = '1') LIMIT 1";
		$category_result = $db->sql_query($category_query);
		$category_row = $db->sql_fetchrow($category_result);
		$category_id = $category_row['categories_id'];
		$category_name = $category_row['categories_name'];

		$prod_image = $Row['products_image'];
		$price = $Row['products_price'];
		$prod_name = $Row['products_name'];
		$prod_descr = $Row['products_description'];
		$special_price = $Row['specials_new_products_price'];
	
		$prod_url = "http://" . $host ."/". "product_info.php?products_id=" . $prod_id;
		$prod_image = "http://" . $host ."/". "images/" . $prod_image;
				
		$tax_result = $db->sql_fetchrow($db->sql_query("select * from " . $vend_prefix . "_tax_rates"));
		$tax = $tax_result['tax_rate'];
		$prod_tax = tep_round($tax, $decimal_places);
		if ($included_tax == 1 ){
			$new_price = $price * ($tax / 100 +1);
		    $new_price = tep_round($new_price, $decimal_places);
		    $prod_price = tep_round($new_price, $decimal_places);
			$new_special_price = $special_price * ($tax / 100 +1);
		    $new_special_price = tep_round($new_special_price, $decimal_places);
		    $prod_special_price = tep_round($new_special_price, $decimal_places);
		} else {
		    $prod_price = tep_round($price, $decimal_places);
		    $prod_special_price = tep_round($special_price, $decimal_places);
		}		
		
		echo "<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a><br/>"
			."&nbsp;Product in Special Offer by ".htmlspecialchars($name)."]]></description>\n"
			."<language>$backend_language</language>\n\n"
			."<item>\n"
			. "<title>".htmlspecialchars($prod_name)."</title>\n"
			. "<link>$prod_url</link>\n";
			//. "<guid>".$vend_id."_".$prod_id."</guid>\n";

?>
<description><![CDATA[A Product in Special Offer by <? echo htmlspecialchars($name); ?>
<br/>
<a href="<? echo $prod_url; ?>"><img alt="<? echo $prod_name; ?>" src="<? echo $prod_image; ?>" align="right" border="0"/></a>
<p>
<?
echo "<b>$prod_name</b><br/><br/>"
	. "<s>$prod_price</s> $currentcurrency <br/><font color=\"red\">$prod_special_price $currentcurrency</font>". "<br/><br/>"
	. $prod_descr ;
?>
</p>]]></description>
<?
		echo "<category>$category_name</category>\n"
			."<dc:creator>$creator</dc:creator>"
			. "<multishop:prod_image>$prod_image</multishop:prod_image>\n"
			. "<multishop:prod_price>$prod_price</multishop:prod_price>\n"
			. "<multishop:prod_special_price>$prod_special_price</multishop:prod_special_price>\n"
			. "<multishop:prod_currency>$currentcurrency</multishop:prod_currency>\n";
		if ($show_tax == 1) echo "<multishop:tax>$prod_tax</multishop:tax>\n";
		echo "</item>\n"
			."</channel>\n"
			."</rss>";
	}
}

function reviews() {
	global $Conf_Multishop, $creator, $nukelogo, $prefix, $shop_id, $backend_language, $sitename, $limit_reviews, $currentcurrency, $language_id, $decimal_places, $db; 
	$today = date("j F Y, G:i:s T"); 
	if (isset($shop_id) && intval($shop_id)){
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_reviews='1' and vendors_id=$shop_id");
		if (!$db->sql_numrows($result)){
			$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_reviews='1' ORDER BY RAND() LIMIT 0,1");
		}
	} else {
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_reviews='1' ORDER BY RAND() LIMIT 0,1");
	}
	
	$row = $db->sql_fetchrow($result);
	$vend_id = $row['vendors_id'];
	$vend_prefix = $row['vendors_prefix'];
	$host = $row['vendors_host'];
	$name = $row['vendors_name'];
	$pos = strrpos($host, '/');
	$host = substr($host, 0, $pos);

	header("Content-Type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
		."<!-- RSS generated by Php-MultiShop for $sitename on $today -->\n"
		."<rss version=\"2.0\" xmlns:multishop=\"http://php-multishop.com/multishop.xml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"
		."<channel>\n"
		."<title>".htmlspecialchars($name)."</title>\n"
		//."<guid>".$vend_id."</guid>\n"
		."<link>http://".$host."</link>\n"
		."<category>".htmlspecialchars($row['vendors_type'])."</category>\n";

	$string_query = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . $vend_prefix . "_" . TABLE_REVIEWS . " r, " . $vend_prefix . "_" . TABLE_REVIEWS_DESCRIPTION . " rd, " . $vend_prefix . "_" . TABLE_PRODUCTS . " p, " . $vend_prefix . "_" . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$language_id . "' and p.products_id = pd.products_id and (pd.language_id = '" . (int)$language_id . "' or pd.language_id = '1') order by r.reviews_id desc limit " . $limit_reviews;
  	$random_product = tep_random_select($string_query);
	
	if ($random_product) {
		
		$review_query = $db->sql_query("select reviews_text from " . $vend_prefix . "_" .  TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$random_product['reviews_id'] . "' and languages_id = '" . (int)$language_id . "'");
    	$review = $db->sql_fetchrow($review_query);
    	$review = tep_break_string(tep_output_string_protected($review['reviews_text']), 15, '-<br>');
		$prod_id    = $random_product['products_id'];
		$prod_name  = $random_product['products_name'];
		$prod_url   = "http://" . $host ."/". "product_info.php?products_id=" . $random_product['products_id'];
		$review_url = "http://" . $host ."/". "product_reviews_info.php?products_id=" . $prod_id . "&amp;reviews_id=" . $random_product['reviews_id'];
		$prod_image = "http://" . $host ."/". "images/" . $random_product['products_image'];
		
		echo "<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a><br/>"
			."&nbsp;Review from ".htmlspecialchars($name)."]]></description>\n"
			."<language>$backend_language</language>\n\n"
			."<item>\n"
			. "<title>".htmlspecialchars($prod_name)."</title>\n"
			. "<link>$review_url</link>\n";
			//. "<guid>". $vend_id. "_". $prod_id. "_". $random_product['reviews_id'] . "</guid>\n";

?>
<description><![CDATA[A Review from <? echo htmlspecialchars($name); ?>
<br/>
<a href="<? echo $prod_url; ?>"><img alt="<? echo $prod_name ; ?>" src="<? echo $prod_image; ?>" align="right" border="0"/></a>
<p>
<?
echo "<b>" . htmlspecialchars($prod_name) . "</b><br/><br/>"
	. nl2br($review) ;
?>
</p>]]></description>
<?
		echo "<category>Reviews</category>\n"
			."<dc:creator>$creator</dc:creator>"
			. "<multishop:prod_image>http://". $host . "/" . $random_product['products_image'] ."</multishop:prod_image>\n"
			. "<multishop:prod_price>$prod_price</multishop:prod_price>\n"
			. "<multishop:prod_currency>$currentcurrency</multishop:prod_currency>\n";
		if ($show_tax == 1) echo "<multishop:tax>$prod_tax</multishop:tax>\n";
		echo "</item>\n"
			."</channel>\n"
			."</rss>";
		
	} else {
		echo "<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a><br/>"
			."&nbsp;Reviews not found on ".htmlspecialchars($name)."]]></description>\n"
			."</channel>\n"
			."</rss>";
	}
	
}

function best(){
	global $Conf_Multishop, $creator, $limit_best, $nukelogo, $prefix, $shop_id, $backend_language, $sitename, $language_id, $db; 
	$today = date("j F Y, G:i:s T"); 
	if (isset($shop_id) && intval($shop_id)){
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_best='1' and vendors_id=$shop_id");
		if (!$db->sql_numrows($result)){
			$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_best='1' ORDER BY RAND() LIMIT 0,1");
		}
	} else {
		$result = $db->sql_query("SELECT * FROM ".$prefix."_vendors where show_best='1' ORDER BY RAND() LIMIT 0,1");
	}
	
	$row = $db->sql_fetchrow($result);
	$vend_id = $row['vendors_id'];
	$vend_prefix = $row['vendors_prefix'];
	$host = $row['vendors_host'];
	$name = $row['vendors_name'];
	$pos = strrpos($host, '/');
	$host = substr($host, 0, $pos);

	header("Content-Type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
		."<!-- RSS generated by Php-MultiShop for $sitename on $today -->\n"
		."<rss version=\"2.0\" xmlns:multishop=\"http://php-multishop.com/multishop.xml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"
		."<channel>\n"
		."<title>".htmlspecialchars($name)."</title>\n"
		//."<guid>".$vend_id."</guid>\n"
		."<link>http://".$host."</link>\n"
		."<category>".htmlspecialchars($row['vendors_type'])."</category>\n"
		."<language>$backend_language</language>\n";

	$best_sellers_query = $db->sql_query("select distinct p.products_id, pd.products_name from " . $vend_prefix . "_" . TABLE_PRODUCTS . " p, " . $vend_prefix . "_" . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$language_id . "' order by p.products_ordered desc, pd.products_name limit " . $limit_best);
	
	if ($db->sql_numrows($best_sellers_query) >= $limit_best) {
		
    	echo "<description>Bestsellers from ".htmlspecialchars($name)."</description>\n\n";
		$rows = 0;
		while ($best_sellers = $db->sql_fetchrow($best_sellers_query)) {
    		
	    	echo "<item>\n"
	    		."<title>".$best_sellers['products_name']."</title>\n"
	    		."<link>http://" . $host . "/product_info.php?products_id=" . $best_sellers['products_id'] . "</link>\n"
	    		//."<guid>".$vend_id."_". $best_sellers['products_id'] ."</guid>\n"
	    		."<description>" . $best_sellers['products_name'] . " </description>"
	    		."</item>\n\n";
    	}  		
		$rows++;
	} else {	
		echo "<description>Bestsellers Not found on ".htmlspecialchars($name)."</description>\n\n";
	}
	echo "</channel>\n"
		."</rss>";
}

function overview(){
	global $sitename, $creator, $nukelogo, $prefix, $backend_language, $db, $Conf_Multishop, $nukeurl;

	$today = date("j F Y, G:i:s T"); 

	header("Content-Type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
		."<!-- RSS generated by Php-MultiShop for $sitename on $today -->\n"
		."<rss version=\"2.0\" xmlns:multishop=\"http://php-multishop.com/multishop.xml\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"
		."<channel>\n"
		."<title>".htmlspecialchars($sitename)."</title>\n"
		."<link>$nukeurl</link>\n"
		."<language>$backend_language</language>\n"
		."<description><![CDATA[<a href=\"". htmlspecialchars($nukeurl) . "\"><img src=\"" . $nukelogo . "\" border=\"0\"></a>"
		."<br/>";
    $result = $db->sql_query("SELECT * FROM ".$prefix."_vendors WHERE vendors_type != 'inactive' ORDER BY vendors_name");
    if ($db->sql_numrows($result)){

		echo "&nbsp;Overview of Shops]]></description>\n\n";
			
    	while ($row = $db->sql_fetchrow($result)) {
    	
	    	$Row = $db->sql_fetchrow($db->sql_query("SELECT logo, shop_english FROM ".$prefix."_vendors_details WHERE vendors_id=$row[vendors_id]"));
	    	$logo = $Row['logo'];
	    	$desc_eng = nl2br($Row['shop_english']);
	    	$url = "http://" . $row['vendors_host'] ;
	    	echo "<item>\n"
	    		."<title>".$row['vendors_name']."</title>\n"
	    		."<link>$url</link>\n";
	    		//."<guid>".$row['vendors_id']."</guid>\n";
	    		
?>
<description><![CDATA[<a href="<? echo $url; ?>">
<?
if ($logo) echo "<a href=\"" . $url . "\"><img alt=\"" .$row['vendors_name']."\" src=\"". $nukeurl."/images/vendors/".$logo . "\" align=\"right\" border=\"0\"/></a>";

echo "<p><b>" . $row['vendors_name'] . "</b><br/><br/>"
	. $desc_eng ;
?>
</p>]]></description>
<?

	    	//if ($logo) echo "<image>".$nukeurl."/images/vendors/".$logo."</image>\n";
	    	echo "</item>\n\n";
	    }
    } else {
    	echo "&nbsp;Shops not Found]]></description>\n\n";
    	echo "<item>\n"
	    	."<title/>\n"
	    	."<link/>\n"
	    	//."<guid/>\n"
	    	."<description/>\n"
	    	."</item>\n\n";
    }
    echo "</channel>\n"
	."</rss>";
}

switch($op) {

    case "prod_random":
    product_random();
	break;

    case "specials":
	specials();
	break;

    case "overview":
	overview();
	break;

    case "reviews":
	reviews();
	break;

    case "best":
	best();
	break;

    default:
    overview();
	break;
}

?>